home *** CD-ROM | disk | FTP | other *** search
Wrap
import java.applet.Applet; import java.awt.Button; import java.awt.CardLayout; import java.awt.Color; import java.awt.Component; import java.awt.Container; import java.awt.Event; import java.awt.Font; import java.awt.Label; import java.awt.LayoutManager; import java.awt.Panel; import java.net.MalformedURLException; import java.net.URL; import symantec.itools.awt.KeyPressManagerPanel; import symantec.itools.db.awt.ImageViewer; import symantec.itools.db.awt.LogonFrame; import symantec.itools.db.awt.TextArea; import symantec.itools.db.awt.TextField; import symantec.itools.db.pro.ConnectionInfo; import symantec.itools.db.pro.RelationView; import symantec.itools.db.pro.Request; import symantec.itools.db.pro.Session; import symantec.itools.lang.Context; import symantec.itools.net.RelativeURL; import symjava.sql.SQLException; public class Reserve extends Applet { Session localhost; LogonFrame localhostLogonFrame; ConnectionInfo Tutorial; RelationView DBA_packages; RelationView DBA_registration; KeyPressManagerPanel keyPressManagerPanel1; Button DBA_packages_prev; Button DBA_packages_next; ImageViewer Image; TextField Package_Name; Label Package_NameLabel; TextArea Description; TextField Price_Per_Person; Label Price_Per_PersonLabel; TextField Number_of_Days; Label Number_of_DaysLabel; TextField Start_Date; Label Start_DateLabel; TextField Package_ID; Label DescriptionLabel; Label Package_IDLabel; symantec.itools.multimedia.ImageViewer imageViewerPackage; Label Package_IDLabel2; Label Customer_Last_NameLabel; Label Customer_EmailLabel; TextField Package_ID2; TextField Customer_First_Name; TextField Customer_Last_Name; TextField Customer_Email; Label Customer_First_NameLabel; Label Customer_PhoneLabel; Label Number_in_PartyLabel; Label Total_CostLabel; TextField Customer_Phone; TextField Number_in_Party; TextField Total_Cost; Button DBA_registration_saveMultiView; Button DBA_registration_undoRecord; symantec.itools.multimedia.ImageViewer imageViewerReg; void NumberInParty_LostFocus(Event event) { this.Total_Cost.setText(String.valueOf(Float.valueOf(this.Price_Per_Person.getText()) * Float.valueOf(this.Number_in_Party.getText()))); } void DBARegistrationSaveMultiView_Clicked(Event event) { try { this.DBA_registration.saveMultiView(); } catch (SQLException e) { System.out.println(((Throwable)e).getMessage()); } try { this.DBA_registration.getNewRecord(); } catch (SQLException e) { System.out.println(((Throwable)e).getMessage()); } this.Package_ID2.setText(this.Package_ID.getText()); } void DBARegistrationUndoRecord_Clicked(Event event) { try { this.DBA_registration.undoRecord(); } catch (SQLException e) { System.out.println(((Throwable)e).getMessage()); } this.Package_ID2.setText(this.Package_ID.getText()); } void DBARegistrationGetNewRecord_Clicked(Event event) { try { this.DBA_registration.getNewRecord(); } catch (SQLException e) { System.out.println(((Throwable)e).getMessage()); } this.Package_ID2.setText(this.Package_ID.getText()); } void DBAPackagesSaveMultiView_Clicked(Event event) { try { this.DBA_packages.saveMultiView(); } catch (SQLException e) { System.out.println(((Throwable)e).getMessage()); } } void DBAPackagesPrev_Clicked(Event event) { try { this.DBA_packages.prev(); } catch (SQLException e) { System.out.println(((Throwable)e).getMessage()); } this.Package_ID2.setText(this.Package_ID.getText()); this.Total_Cost.setText(String.valueOf(Float.valueOf(this.Price_Per_Person.getText()) * Float.valueOf(this.Number_in_Party.getText()))); } void DBAPackagesNext_Clicked(Event event) { try { this.DBA_packages.next(); } catch (SQLException e) { System.out.println(((Throwable)e).getMessage()); } this.Package_ID2.setText(this.Package_ID.getText()); this.Total_Cost.setText(String.valueOf(Float.valueOf(this.Price_Per_Person.getText()) * Float.valueOf(this.Number_in_Party.getText()))); } public void init() { super.init(); Context.setDocumentBase(((Applet)this).getDocumentBase()); ((Container)this).setLayout(new CardLayout(0, 0)); ((Panel)this).addNotify(); ((Applet)this).resize(713, 533); ((Component)this).setFont(new Font("Dialog", 1, 12)); ((Component)this).setForeground(new Color(0)); ((Component)this).setBackground(new Color(16777215)); try { this.localhost = new Session("dbaw://localhost:8889"); this.localhostLogonFrame = new LogonFrame(); this.localhost.setLogonObject(this.localhostLogonFrame); } catch (SQLException e) { System.out.println(((Throwable)e).getMessage()); return; } this.Tutorial = new ConnectionInfo("Tutorial"); this.Tutorial.setUser("dba"); this.Tutorial.setPassword("sql"); this.Tutorial.setAutoDisconnect(false); try { Request DBA_packagesRequest = new Request(this.localhost, this.Tutorial); DBA_packagesRequest.setSQL("SELECT Package_ID,Package_Name,Start_Date,Number_of_Days,Price_Per_Person,Image,Description FROM DBA.packages"); DBA_packagesRequest.setOptimisticConcurrency("All"); DBA_packagesRequest.setInitialRecordPosition("First"); this.DBA_packages = new RelationView(DBA_packagesRequest); this.DBA_packages.setName("DBA_packages"); } catch (SQLException e) { System.out.println(((Throwable)e).getMessage()); return; } try { Request DBA_registrationRequest = new Request(this.localhost, this.Tutorial); DBA_registrationRequest.setSQL("SELECT Package_ID,Customer_First_Name,Customer_Last_Name,Customer_Email,Customer_Phone,Number_in_Party,Total_Cost FROM DBA.registration"); DBA_registrationRequest.setOptimisticConcurrency("All"); DBA_registrationRequest.setInitialRecordPosition("New"); this.DBA_registration = new RelationView(DBA_registrationRequest); this.DBA_registration.setName("DBA_registration"); } catch (SQLException e) { System.out.println(((Throwable)e).getMessage()); return; } this.keyPressManagerPanel1 = new KeyPressManagerPanel(); this.keyPressManagerPanel1.setLayout((LayoutManager)null); this.keyPressManagerPanel1.reshape(0, 0, 713, 533); ((Container)this).add(this.keyPressManagerPanel1); this.DBA_packages_prev = new Button("Previous"); this.DBA_packages_prev.reshape(192, 325, 65, 20); this.keyPressManagerPanel1.add(this.DBA_packages_prev); this.DBA_packages_next = new Button("Next"); this.DBA_packages_next.reshape(264, 325, 65, 20); this.keyPressManagerPanel1.add(this.DBA_packages_next); this.Image = new ImageViewer(); this.Image.setBinding(this.DBA_packages, "Image"); this.Image.reshape(5, 88, 336, 228); this.keyPressManagerPanel1.add(this.Image); this.Package_Name = new TextField(); this.Package_Name.setBinding(this.DBA_packages, "Package_Name"); this.Package_Name.setDynamicUpdate(false); this.Package_Name.setTreatBlankAs("Default"); this.Package_Name.setEditable(false); this.Package_Name.reshape(125, 64, 204, 20); this.Package_Name.setBackground(new Color(8421504)); this.keyPressManagerPanel1.add(this.Package_Name); this.Package_NameLabel = new Label("Package Name"); this.Package_NameLabel.reshape(5, 64, 108, 20); this.keyPressManagerPanel1.add(this.Package_NameLabel); this.Description = new TextArea(); this.Description.setBinding(this.DBA_packages, "Description"); this.Description.setDynamicUpdate(false); this.Description.setTreatBlankAs("Default"); this.Description.setEditable(false); this.Description.reshape(365, 184, 276, 120); this.Description.setBackground(new Color(8421504)); this.keyPressManagerPanel1.add(this.Description); this.Price_Per_Person = new TextField(); this.Price_Per_Person.setBinding(this.DBA_packages, "Price_Per_Person"); this.Price_Per_Person.setDynamicUpdate(false); this.Price_Per_Person.setTreatBlankAs("Default"); this.Price_Per_Person.setEditable(false); this.Price_Per_Person.reshape(473, 136, 80, 20); this.Price_Per_Person.setBackground(new Color(8421504)); this.keyPressManagerPanel1.add(this.Price_Per_Person); this.Price_Per_PersonLabel = new Label("Price Per Person"); this.Price_Per_PersonLabel.reshape(353, 136, 120, 20); this.keyPressManagerPanel1.add(this.Price_Per_PersonLabel); this.Number_of_Days = new TextField(); this.Number_of_Days.setBinding(this.DBA_packages, "Number_of_Days"); this.Number_of_Days.setDynamicUpdate(false); this.Number_of_Days.setTreatBlankAs("Default"); this.Number_of_Days.setEditable(false); this.Number_of_Days.reshape(473, 112, 80, 20); this.Number_of_Days.setBackground(new Color(8421504)); this.keyPressManagerPanel1.add(this.Number_of_Days); this.Number_of_DaysLabel = new Label("Number of Days"); this.Number_of_DaysLabel.reshape(353, 112, 108, 20); this.keyPressManagerPanel1.add(this.Number_of_DaysLabel); this.Start_Date = new TextField(); this.Start_Date.setBinding(this.DBA_packages, "Start_Date"); this.Start_Date.setDynamicUpdate(false); this.Start_Date.setTreatBlankAs("Default"); this.Start_Date.setEditable(false); this.Start_Date.reshape(473, 88, 80, 20); this.Start_Date.setBackground(new Color(8421504)); this.keyPressManagerPanel1.add(this.Start_Date); this.Start_DateLabel = new Label("Start Date"); this.Start_DateLabel.reshape(353, 88, 96, 20); this.keyPressManagerPanel1.add(this.Start_DateLabel); this.Package_ID = new TextField(); this.Package_ID.setBinding(this.DBA_packages, "Package_ID"); this.Package_ID.setDynamicUpdate(false); this.Package_ID.setTreatBlankAs("Default"); this.Package_ID.setEditable(false); this.Package_ID.reshape(473, 64, 80, 20); this.Package_ID.setBackground(new Color(8421504)); this.keyPressManagerPanel1.add(this.Package_ID); this.DescriptionLabel = new Label("Description"); this.DescriptionLabel.reshape(353, 160, 108, 20); this.keyPressManagerPanel1.add(this.DescriptionLabel); this.Package_IDLabel = new Label("Package ID"); this.Package_IDLabel.reshape(353, 64, 108, 20); this.keyPressManagerPanel1.add(this.Package_IDLabel); this.imageViewerPackage = new symantec.itools.multimedia.ImageViewer(); this.imageViewerPackage.reshape(4, 10, 523, 42); this.keyPressManagerPanel1.add(this.imageViewerPackage); this.imageViewerPackage.setCenterMode(false); try { this.imageViewerPackage.setURL(RelativeURL.getURL("Images/reserv.gif")); } catch (MalformedURLException var3) { } this.Package_IDLabel2 = new Label("Package ID"); this.Package_IDLabel2.reshape(5, 397, 98, 20); this.keyPressManagerPanel1.add(this.Package_IDLabel2); this.Customer_Last_NameLabel = new Label("Last Name"); this.Customer_Last_NameLabel.reshape(5, 445, 98, 20); this.keyPressManagerPanel1.add(this.Customer_Last_NameLabel); this.Customer_EmailLabel = new Label("E-mail"); this.Customer_EmailLabel.reshape(5, 469, 98, 20); this.keyPressManagerPanel1.add(this.Customer_EmailLabel); this.Package_ID2 = new TextField(); this.Package_ID2.setBinding(this.DBA_registration, "Package_ID"); this.Package_ID2.setDynamicUpdate(false); this.Package_ID2.setTreatBlankAs("Default"); this.Package_ID2.setEditable(false); this.Package_ID2.setText("780"); this.Package_ID2.reshape(113, 397, 80, 20); this.Package_ID2.setBackground(new Color(8421504)); this.keyPressManagerPanel1.add(this.Package_ID2); this.Customer_First_Name = new TextField(); this.Customer_First_Name.setBinding(this.DBA_registration, "Customer_First_Name"); this.Customer_First_Name.setDynamicUpdate(false); this.Customer_First_Name.setTreatBlankAs("Default"); this.Customer_First_Name.reshape(113, 421, 320, 20); this.keyPressManagerPanel1.add(this.Customer_First_Name); this.Customer_Last_Name = new TextField(); this.Customer_Last_Name.setBinding(this.DBA_registration, "Customer_Last_Name"); this.Customer_Last_Name.setDynamicUpdate(false); this.Customer_Last_Name.setTreatBlankAs("Default"); this.Customer_Last_Name.reshape(113, 445, 320, 20); this.keyPressManagerPanel1.add(this.Customer_Last_Name); this.Customer_Email = new TextField(); this.Customer_Email.setBinding(this.DBA_registration, "Customer_Email"); this.Customer_Email.setDynamicUpdate(false); this.Customer_Email.setTreatBlankAs("Default"); this.Customer_Email.reshape(113, 469, 320, 20); this.keyPressManagerPanel1.add(this.Customer_Email); this.Customer_First_NameLabel = new Label("First Name"); this.Customer_First_NameLabel.reshape(5, 421, 98, 20); this.keyPressManagerPanel1.add(this.Customer_First_NameLabel); this.Customer_PhoneLabel = new Label("Phone"); this.Customer_PhoneLabel.reshape(437, 397, 98, 20); this.keyPressManagerPanel1.add(this.Customer_PhoneLabel); this.Number_in_PartyLabel = new Label("Number in Party"); this.Number_in_PartyLabel.reshape(437, 421, 105, 20); this.keyPressManagerPanel1.add(this.Number_in_PartyLabel); this.Total_CostLabel = new Label("Total Cost"); this.Total_CostLabel.reshape(437, 445, 98, 20); this.keyPressManagerPanel1.add(this.Total_CostLabel); this.Customer_Phone = new TextField(); this.Customer_Phone.setBinding(this.DBA_registration, "Customer_Phone"); this.Customer_Phone.setDynamicUpdate(false); this.Customer_Phone.setTreatBlankAs("Default"); this.Customer_Phone.reshape(545, 397, 120, 20); this.keyPressManagerPanel1.add(this.Customer_Phone); this.Number_in_Party = new TextField(); this.Number_in_Party.setBinding(this.DBA_registration, "Number_in_Party"); this.Number_in_Party.setDynamicUpdate(false); this.Number_in_Party.setTreatBlankAs("Default"); this.Number_in_Party.reshape(545, 421, 80, 20); this.keyPressManagerPanel1.add(this.Number_in_Party); this.Total_Cost = new TextField(); this.Total_Cost.setBinding(this.DBA_registration, "Total_Cost"); this.Total_Cost.setDynamicUpdate(false); this.Total_Cost.setTreatBlankAs("Default"); this.Total_Cost.setEditable(false); this.Total_Cost.reshape(545, 445, 160, 20); this.Total_Cost.setBackground(new Color(8421504)); this.keyPressManagerPanel1.add(this.Total_Cost); this.DBA_registration_saveMultiView = new Button("Send Registration"); this.DBA_registration_saveMultiView.reshape(311, 505, 120, 20); this.keyPressManagerPanel1.add(this.DBA_registration_saveMultiView); this.DBA_registration_undoRecord = new Button("Clear"); this.DBA_registration_undoRecord.reshape(235, 505, 65, 20); this.keyPressManagerPanel1.add(this.DBA_registration_undoRecord); this.imageViewerReg = new symantec.itools.multimedia.ImageViewer(); this.imageViewerReg.reshape(4, 357, 536, 32); this.keyPressManagerPanel1.add(this.imageViewerReg); this.imageViewerReg.setCenterMode(false); try { this.imageViewerReg.setURL(new URL("file:/C:/VisualCafePro/MyApps/AppletDb/Images/register.gif")); } catch (MalformedURLException var2) { } } public boolean handleEvent(Event event) { if (event.target == this.DBA_packages_next && event.id == 1001) { this.DBAPackagesNext_Clicked(event); return true; } else if (event.target == this.DBA_packages_prev && event.id == 1001) { this.DBAPackagesPrev_Clicked(event); return true; } else if (event.target == this.DBA_registration_undoRecord && event.id == 1001) { this.DBARegistrationUndoRecord_Clicked(event); return true; } else if (event.target == this.DBA_registration_saveMultiView && event.id == 1001) { this.DBARegistrationSaveMultiView_Clicked(event); return true; } else if (event.target == this.Number_in_Party && event.id == 1005) { this.NumberInParty_LostFocus(event); return true; } else { return super.handleEvent(event); } } }